package com.c6;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/twoServet")
public class RegisterServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
        response.setCharacterEncoding("UTF-8");
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html");
        String userName = request.getParameter("userName");
        String userPwd = request.getParameter("userPwd");
        String email = request.getParameter("email");
        String userSex = request.getParameter("userSex");
        String userEducation = request.getParameter("userEducation");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>用户注册结果</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<br/>");
        out.println("<h3>用户注册结果</h3>");
        out.println("<table border=1 align=left>");
        out.println("<tr><th>参数</th><th>参数值</th></tr>");
        out.println("<tr><td>userName</td><td>"+userName+"</td></tr>");
        out.println("<tr><td>userPwa</td><td>"+userPwd+"</td></tr>");
        out.println("<tr><td>email</td><td>"+email+"</td></tr>");
        out.println("<tr><td>userSex</td><td>"+userSex+"</td></tr>");
        out.println("<tr><td>userEducation</td><td>"+userEducation+"</td></tr>");
        out.println("</table>");
        out.println("</body>");
        out.println("</html>");
        out.flush();
        out.close();
    }
    protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
        doPost(request,response);
    }
}